import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ContactVO, ContactForm, ContactQuery } from '@/api/yuanshidian/contact/types';

/**
 * 查询社保接收联络函列表
 * @param query
 * @returns {*}
 */

export const listContact = (query?: ContactQuery): AxiosPromise<ContactVO[]> => {
  return request({
    url: '/yuanshidian/contact/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询社保接收联络函详细
 * @param id
 */
export const getContact = (id: string | number): AxiosPromise<ContactVO> => {
  return request({
    url: '/yuanshidian/contact/' + id,
    method: 'get'
  });
};

/**
 * 新增社保接收联络函
 * @param data
 */
export const addContact = (data: ContactForm) => {
  return request({
    url: '/yuanshidian/contact',
    method: 'post',
    data: data
  });
};

/**
 * 修改社保接收联络函
 * @param data
 */
export const updateContact = (data: ContactForm) => {
  return request({
    url: '/yuanshidian/contact',
    method: 'put',
    data: data
  });
};

/**
 * 删除社保接收联络函
 * @param id
 */
export const delContact = (id: string | number | Array<string | number>) => {
  return request({
    url: '/yuanshidian/contact/' + id,
    method: 'delete'
  });
};
